package com.gxl.hessian.demo.conf;

import com.caucho.hessian.server.HessianServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: zro
 * @Date: 2019-12-6 15:12
 * @Description:
 */
@Configuration
public class ServletConf {

    @Bean
    public ServletRegistrationBean myServlet() {

        ServletRegistrationBean registrationBean =
                new ServletRegistrationBean(new HessianServlet(), "/hessian");

        Map<String,String> params = new HashMap<>();
        params.put("service-class", "com.gxl.hessian.demo.server.impl.HelloHessianImpl");
        registrationBean.setInitParameters(params);

        return registrationBean;

    }
}
